// summary
//  this will initialize the global djConfig object based
//  on the parameters that are passed in through the url.
//
//  this should be the very first javascript file that is
//  added to each page, before the dojo.js file, in order
//  for it to work.
//
var getLocale = function () {
	var locale = "", country = "";
	if ('href' in window.location) {
		var paramString = window.location.href;
		var qmark = paramString.indexOf('?');
		if (qmark !== -1) {
			// get everything after the '?'
			paramString = paramString.substring(qmark + 1);
		}
		var pairs = paramString.split('&');
		// add each pair to the parameter map
		for (var i = 0; i < pairs.length; i++) {
			var pair = pairs[i];
			var kvpair = pair.split('=');
			if (kvpair.length === 2) {
				if (kvpair[0] === 'userLang') {
					locale = kvpair[1];
				}
				if (kvpair[0] === 'userCountry') {
					country = kvpair[1].toLowerCase();
				}
			}
		}
	}
	return locale + (country.length > 0 ? "-" + country : "");
};

var dojoConfig = {
		async: true,
		packages: [{name: "maga", location: "../../cone"}],
		locale: getLocale()
	};
